From: Wei Liu Date: Thu, 11 Jan 2018 17:47:58 +0000 (+0000) Subject: tools/libelf: fix elf notes check for PVH guest X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~823 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=2dd3e229494649fcf3309f8e2ccecece2a2d1685;p=xen.git tools/libelf: fix elf notes check for PVH guest PVH only requires PHYS32_ENTRY to be set. Return immediately if that's the case. Also remove the printk in pvh_load_kernel. Signed-off-by: Wei Liu Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index d696d4cd97..7d177a1d7d 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -484,10 +484,6 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image, return -EINVAL; } - printk("OS: %s version: %s loader: %s bitness: %s\n", parms.guest_os, - parms.guest_ver, parms.loader, - elf_64bit(&elf) ? "64-bit" : "32-bit"); - /* Copy the OS image and free temporary buffer. */ elf.dest_base = (void *)(parms.virt_kstart - parms.virt_base); elf.dest_size = parms.virt_kend - parms.virt_kstart; diff --git a/xen/common/libelf/libelf-dominfo.c b/xen/common/libelf/libelf-dominfo.c index 829d5176a9..508f08db42 100644 --- a/xen/common/libelf/libelf-dominfo.c +++ b/xen/common/libelf/libelf-dominfo.c @@ -381,6 +381,13 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary *elf, return 0; } + /* PVH only requires one ELF note to be set */ + if ( parms->phys_entry != UNSET_ADDR32 ) + { + elf_msg(elf, "ELF: Found PVH image\n"); + return 0; + } + /* Check the contents of the Xen notes or guest string. */ if ( ((strlen(parms->loader) == 0) || strncmp(parms->loader, "generic", 7)) && @@ -389,7 +396,7 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary *elf, { elf_err(elf, "ERROR: Will only load images built for the generic loader or Linux images" - " (Not '%.*s' and '%.*s')\n", + " (Not '%.*s' and '%.*s') or with PHYS32_ENTRY set\n", (int)sizeof(parms->loader), parms->loader, (int)sizeof(parms->guest_os), parms->guest_os); return -1;